# \api\urls.py
from django.urls import path, include
from rest_framework import routers
from . import views 
from .views import (
    PublicAnnouncementListView,
    StudentViewSet,
    LoginView,
    PublicStudentListView,
    ReadingMaterialViewSet,
    SingleChoiceQuestionViewSet,
    MultipleChoiceQuestionViewSet,
    FillInBlankQuestionViewSet,
    TaskViewSet,
    ExperimentViewSet,
    StudentExperimentProgressViewSet,
    StudentAnswerRecordViewSet,
    StudentGroupViewSet,
    PublicReadingMaterialViewSet,
    PublicSingleChoiceQuestionViewSet,
    PublicMultipleChoiceQuestionViewSet,
    PublicFillInBlankQuestionViewSet,
    PublicTaskViewSet,
    PublicExperimentViewSet,
    TeacherExperimentViewSet,
    TeacherEvaluationViewSet,
    ExperimentAnnouncementViewSet,
    ExperimentViewSet,
    CodeQuestionViewSet,
    CodeSubmissionViewSet
)

router = routers.DefaultRouter()
router.register(r'students', StudentViewSet)
router.register(r'reading-materials',ReadingMaterialViewSet)
router.register(r'single-choice-questions',SingleChoiceQuestionViewSet)
router.register(r'multiple-choice-questions',MultipleChoiceQuestionViewSet)
router.register(r'fill-in-blank-questions',FillInBlankQuestionViewSet)
router.register(r'tasks',TaskViewSet)

router.register(r'teacher/experiments', TeacherExperimentViewSet, basename='teacher-experiment')

router.register(r'experiments',ExperimentViewSet)
router.register(r'student-progress',StudentExperimentProgressViewSet)
router.register(r'student-answers',StudentAnswerRecordViewSet)
router.register(r'student-groups', StudentGroupViewSet)

# 新增的公共视图
router.register(r'public/reading-materials', PublicReadingMaterialViewSet, basename='public-readingmaterial')
router.register(r'public/single-choice-questions', PublicSingleChoiceQuestionViewSet, basename='public-singlechoicequestion')
router.register(r'public/multiple-choice-questions', PublicMultipleChoiceQuestionViewSet, basename='public-multiplechoicequestion')
router.register(r'public/fill-in-blank-questions', PublicFillInBlankQuestionViewSet, basename='public-fillinblankquestion')
router.register(r'public/tasks', PublicTaskViewSet, basename='public-task')
router.register(r'public/experiments', PublicExperimentViewSet, basename='public-experiment')
router.register(r'teacher/evaluations', TeacherEvaluationViewSet, basename='teacher-evaluation')
router.register(r'teacher/announcements', ExperimentAnnouncementViewSet, basename='teacher-announcement')
router.register(r'code-questions', CodeQuestionViewSet, basename='code-question')
router.register(r'code-submissions', CodeSubmissionViewSet, basename='code-submission')
urlpatterns = [
    path('login/', views.LoginView.as_view(), name='login'),
    path('students/display/', PublicStudentListView.as_view(), name='public-student-display'),
    path('', include(router.urls)),
    path('public-announcements/', views.PublicAnnouncementListView.as_view(), name='public-announcement-list'),
]